﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ShopSpace.Core.Query;

namespace ShopSpace.Core.Specification
{
	public class PersonUsernameSpecification : CompositeSpecification<Person>
	{
		public string Username
		{
			get;
			set;
		}

		public PersonUsernameSpecification(string username)
		{
			this.Username = username;
		}
		
		public override bool IsSatisfiedBy(Person candidate)
		{
			return candidate.Username == this.Username;
		}

		public override QueryBuilder<Person> AsQueryBuilder()
		{
			return Where.Person.Username.Eq(this.Username);
		}
	}
}
